import java.sql.SQLOutput;
import java.util.Random;
import java.util.Scanner;

public class Text {
    public static void main1(String[] args) {
        System.out.println("1");
        System.out.println("2");
        System.out.println("3");

    }

    public static void main2(String[] args) {
        int a = 10;
        if(a == 10){
            System.out.println("a == 10");
        }
    }

    public static void main3(String[] args) {
        int a = 10;
        if(a == 10){
            System.out.println("a == 10");
        }else{
            System.out.println("a != 10");
        }
    }

    public static void main4(String[] args) {
        int a = 10;
        if(a<10){

        }else if(a>15){

        }else{

        }
    }
//1. 判断一个数字是奇数还是偶数
    public static void main5(String[] args) {
        int a = 10;
        if(a % 2 != 0){
            System.out.println("奇数！");
        }else{
            System.out.println("偶数！");
        }
    }
    //2. 判断一个数字是正数，负数，还是零
    public static void main6(String[] args) {
        int a = 10;
        if(a > 0){
            System.out.println("正数！");
        }else if(a < 0){
            System.out.println("负数！");
        }else{
            System.out.println("0!");
        }
    }
    //3. 判断一个年份是否为闰年
    public static void main7(String[] args) {
        int year = 2022;
        if(year % 100 == 0) {
            if(year % 400 == 0) {
                System.out.println(year + "是闰年！");
            }else {
                System.out.println(year + "不是闰年！");
            }
        }else {
            if(year % 4 == 0) {
                System.out.println(year + "是闰年！");
            }else {
                System.out.println(year + "不是闰年！");
            }
        }
    }

    public static void main8(String[] args) {
        int a = 1;
        while(a <= 10) {
            System.out.println(a);
            a++;
        }
    }
    //求1-100的和
    public static void main9(String[] args) {
        int a = 0;
        int sum = 0;
        while(a <= 100){
            sum+=a;
            a++;
        }
        System.out.println(sum);
        System.out.println("================");
        //奇数的和
        a = 1;
        int sum2 = 0;
        while (a <= 100) {
            sum2 += a;
            a += 2;
        }
        System.out.println(sum2);
        System.out.println("================");
        //偶数的和
        a=2;
        int sum3=0;
        while(a <= 100) {
            sum3 += a;
            a += 2;
        }
        System.out.println(sum3);
    }
    //求5的阶乘
    public static void main10(String[] args) {
        int a = 1;
        int ret = 1;
        while(a <= 5) {
            ret *= a;
            a++;
        }
        System.out.println(ret);
    }
    // 1! + 2! + 3! + 4! + 5!
    public static void main11(String[] args) {
        int i = 1;
        int sum = 0;
        while( i <= 5) {
            int a = 1;
            int ret = 1;
            while(a <= i) {
                ret *= a;
                a++;
            }
            sum += ret;
            i++;
        }
        System.out.println(sum);
    }

    public static void main12(String[] args) {
        int a = 1;
        while(a <= 10) {
            if(a == 2) {
                break;
            }
            System.out.println(a);
            a++;
        }
    }

    public static void main13(String[] args) {
        int a = 1;
        while(a <= 10) {
            if(a == 2) {
                a++;
                continue;
            }
            System.out.println(a);
            a++;
        }
    }

    public static void main14(String[] args) {
        //找到1-100内，既能被3整除，也能被5整除的数字
        //要求：使用break或者continue当中的一个。
        int a = 1;
        while(a <= 100) {
            if(a % 3 == 0 && a % 5 == 0) {
                System.out.println(a);
                a++;
                continue;
            }
            a++;
        }
    }

    public static void main15(String[] args) {
        for (int i = 0; i < 10; i++) {
            System.out.println(i);
        }
    }

    //求1! + 2! + 3! + 4! + 5!
    public static void main16(String[] args) {
        int sum = 0;
        for(int k = 1; k <= 5; k++) {
            int ret = 1;
            for(int i  = 1; i <= k; i++) {
                ret *= i;
            }
            sum += ret;
        }
        System.out.println(sum);
    }

    public static void main17(String[] args) {
        int i = 0;
        do {
            System.out.println(i);
            i++;
        }while(i < 10);
    }

    public static void main18(String[] args) {
        Scanner scan = new Scanner(System.in);
        System.out.println("请输入姓名：");
        String name = scan.nextLine();
        System.out.println(name);

        System.out.println("请输入年龄：");
        int n = scan.nextInt();
        System.out.println(n);

        System.out.println("请输入你的工资：");
        float f = scan.nextFloat();
        System.out.println(f);

        scan.close();
    }

    public static void main19(String[] args) {
        Scanner scan = new Scanner(System.in);
        System.out.println("请输入姓名：");
        //.next 遇到空格就结束了
        String name = scan.next();
        System.out.println(name);

        String name2 = scan.next();
        System.out.println(name2);
    }

    public static void main20(String[] args) {
        Scanner scan = new Scanner(System.in);

        System.out.println("请输入年龄：");
        int n = scan.nextInt();
        System.out.println(n);

        //处理：
        //scan.nextLine();

        //此时，上面输完之后，回车 会被下边读取到
        System.out.println("请输入姓名：");
        String name = scan.nextLine();
        System.out.println(name);
    }

    public static void main21(String[] args) {
        Scanner scan = new Scanner(System.in);
        //循环多次读入
        while(scan.hasNextInt()) {
            int n = scan.nextInt();
            System.out.println("n = "+n);
        }
    }

    public static void main22(String[] args) {
        Scanner scan = new Scanner(System.in);
        Random random = new Random();
        //int randNum = random.nextInt(100)+100;//[100,200)
       // int randNum = random.nextInt(50)+50;//[50,100)
        int randNum = random.nextInt(100);//[0,100)
        while(true) {
            System.out.println("请输入你要猜的数字：");
            int num = scan.nextInt();
            if(num > randNum) {
                System.out.println("猜大了!");
            }else if(num == randNum) {
                System.out.println("猜对了！");
                break;
            }else {
                System.out.println("猜小了！");
            }
        }
    }

    //打印 1 - 100 之间所有的素数
    public static void main23(String[] args) {
        for(int i = 2;i <= 100; i++){
            int j = 0;
            for(j = 2; j < i; j++){
                if(i % j == 0) {
                    break;

                }
            }
            if(i == j) {
                System.out.print(i+" ");
            }
        }
    }
    //编写程序数一下 1到 100 的所有整数中出现多少个数字9
    public static void main24(String[] args) {
        int i = 1;
        int count = 0;
        for(i = 1; i <= 100; i++) {
            if(i % 10 == 9){
                count++;
            }else if((i / 10 == 9)) {
                count++;
            }
        }
        System.out.println(count);
    }
    //输出 1000 - 2000 之间所有的闰年
    public static void main25(String[] args) {
        int y = 1000;
        int count = 0;
        for(y = 1000; y <= 2000; y++) {
            if(((y % 4 == 0) && (y % 100 != 0)) || (y % 400 == 0)) {
                System.out.print(y + " ");
                count++;
            }
        }
        System.out.println("\n"+count);
    }
    //给定一个数字，判定一个数字是否是素数
    public static void main26(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int i = 0;
        for(i = 2; i < n; i++) {
            if(n % i == 0){
                System.out.println(n+"不是素数");
                break;
            }
        }
        if(n == i) {
            System.out.println(n+"是素数");
        }
    }
    //求一个整数，在内存当中存储时，二进制1的个数。
    public static void main27(String[] args) {
    Scanner input = new Scanner(System.in);
    int a = input.nextInt();
    int i = 0;
    int count = 0;
    for(i = 0; i < 32; i++) {
        if(((a >> i) & 1) == 1) {
            count++;
        }
    }
        System.out.println(count);
    }
    //    给定两个数，求这两个数的最大公约数
    //    例如：
    //    输入：20 40
    //    输出：20
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int a = input.nextInt();
        int b = input.nextInt();
        for(int i = (a < b ? a : b);i > 1 ; i--) {
            if(a % i == 0 && b % i == 0) {
                System.out.println(i);
                break;
            }
        }
    }






}



